Java Testing with Selenium by Sujay Raghavendra
Author: Sujay Raghavendra , Date: July 2, 2024
, Views: 201
Selecting and Deselecting Options with MultiSelectList
A MultiSelectList element lets you select and deselect multiple options. Letâs discuss how to interact with them using Selenium.
Selecting Multiple Options
The Select class interacts with a SelectList element and selects multiple options by visible text, value, or index.Select languagesSelectList = new Select(driver.findElement(By.id("languages")));
languagesSelectList.selectByVisibleText("Java");
languagesSelectList.selectByValue("python");
languagesSelectList.selectByIndex(2); // 0-based index, selects "JavaScript"
Copyright Disclaimer:
This site does not store any files on its server. We only index and link
to content provided by other sites. Please contact the content providers
to delete copyright contents if any and email us, we'll remove relevant
links or contents immediately.